<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\CouponCategory */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="coupon-category-form">

    <?php $form = ActiveForm::begin(['options'=>['enctype'=>'multipart/form-data','id'=>'main']]); ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'mark_id')->textInput() ?>

    <?= $form->field($model, 'group_id')->textInput() ?>

    <?= $form->field($model, 'origin_num')->textInput() ?>

    <?= $form->field($model, 'use_num')->textInput() ?>

    <?= $form->field($model, 'status')->dropDownList(['失效','有效'],['options' => [$model->status => ['selected' => 'selected']],['prompt'=>1]]) ?>

    <?= $form->field($model, 'local_mark_id')->textInput(['maxlength' => true]) ?>

    <?php
    $created_at = Html::tag('label', "优惠券创建时间", ['class' => 'control-label']);
    $created_at.=Html::tag('div', $model->created_at?date("Y-m-d H:i:s",$model->created_at):date("Y-m-d H:i:s"));
    echo Html::tag('div', $created_at, ['class'=>'form-group field-couponcategory-created_at']);?>

    <?php
    $updated_at = Html::tag('label', "优惠券修改时间", ['class' => 'control-label']);
    $updated_at.=Html::tag('div', $model->updated_at?date("Y-m-d H:i:s",$model->updated_at):date("Y-m-d H:i:s"));
    echo Html::tag('div', $updated_at, ['class'=>'form-group field-couponcategory-created_at']);?>

    <?= $form->field($model, 'type')->dropDownList([1=>'一码一用',2=>'一码多用'],['options' => [$model->type => ['selected' => 'selected']],['prompt'=>2]]) ?>

    <?= $form->field($model, 'pic')->fileInput() ?>
    <?= Html::img($model->image,['style'=>"height:50px;"])?>

    <div class="form-group">
        <?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
